home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2137 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  50 lines

  1. Path: mail2news.demon.co.uk!iiga.demon.co.uk
  2. From: Pete Ryan <pete@iiga.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Returning a variable from system() function
  5. Date: Fri, 19 Jan 1996 10:04:20 GMT
  6. Organization: None
  7. Message-ID: <295336694wnr@iiga.demon.co.uk>
  8. Reply-To: pete@iiga.demon.co.uk
  9. X-NNTP-Posting-Host: iiga.demon.co.uk
  10. X-Broken-Date: Friday, Jan 19, 1996 10.04.20
  11. X-Newsreader: Newswin Alpha 0.7
  12. X-Mail2News-Path: relay-4.mail.demon.net!post.demon.co.uk!iiga.demon.co.uk
  13.  
  14. Hiya,
  15.     I`ve just been experimenting with C on UNIX and have come across a 
  16. problem!.  There is a UNIX command called `find / -name gwire -print` 
  17. which scans the UNIX drive for files/directories containing `gwire`.  
  18. Anyway what I want to do is the following...
  19.  
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. etc
  23.  
  24. void main()
  25. {
  26.     char    tmp[];
  27.     
  28.     chdir("/usr2/willesden");    
  29.     
  30.     */ offending code below ;( */
  31.     tmp = system("find . -name gwire");
  32.  
  33.     printf("%s",tmp");
  34.  
  35. }
  36.  
  37. Therefore if I run `find . -name gwire -print` it returns all the 
  38. directories containing `gwire`.  However the code above does not 
  39. work!!. Is it because `= system` returns an integer and not strings???
  40.  
  41. Any help would be very much appreciated as I have only just started 
  42. learning c in the last 2 months.  
  43.  
  44.  
  45. -------------------------------| 
  46. | EMail pete@                  |
  47. | Mail sent via Demon Internet |
  48. --------------------------------
  49.  
  50.